home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / HackAddict™ Magazine / HA 1-12 / HackAddict12.sit / HackAddict 12 ƒ / Files / CrackIt 1.0 / CrackIt 1.0 source code next >
Text File  |  1998-03-18  |  22KB  |  692 lines

  1. **************************************************************************************
  2. *Ladies, gents and others!  This is the source code, in assembely, for CrackIt 1.0.
  3. *However, this is only one of the four documents containing the complete source code.
  4. *I did not include the documents dealing with event handeling and stuff like that.
  5. *If you take a good look at it you might notice that it is compiled with PowerFantasm. 
  6. *I don't recomend for you to try and compile it, as it needs the other documents to be
  7. *fully functional.  This mearly contains the code for the three Reg Types (that can
  8. *be selected from the file menu).  And in the end there are the subroutines dealing
  9. *with the dialog boxes.  
  10. *The organization might be a bit confusing, but as long as you jump from subroutine
  11. *to subroutine, you should be OK.  Just ignore the location of the routines!
  12. *It contains rather good commenting, I think. When you see a star, that is the sign 
  13. *for the fact that I will comment the current instruction or subroutine.  
  14. *Subroutines are marked by a name followed by a collon.  ei. "smartass:" marks the
  15. *beginning of the subroutine "smartass".
  16. *Enjoy!  And I hope you can follow it through!
  17. *OH yeah!  And don't forget, I do this for you so don't laugh about my spelling 
  18. *mistakes!
  19. **************************************************************************************
  20.  
  21. **Necessary stuff**
  22. ExitToShell:    EQU        $A9F4
  23. Initresoruces:    equ        $a995
  24. GetNewWindow:    EQU        $A9BD
  25. showwindow:        equ        $a915
  26. GetNewDialog:    EQU        $A97C
  27. GetDialogItem:    equ        $a98d
  28. IsDialogEvent:    EQU        $A97F
  29. DisposDialog:    EQU        $A983
  30. DialogSelect:    EQU        $A980
  31. ModalDialog:    EQU        $A991
  32. GetIText:        EQU        $A990
  33. stringtonum:    equ        $a9ee
  34. DrawString:        equ        $A884
  35. newpointerclear:    equ    $a31e
  36.  
  37. ************************************************************************************
  38.  
  39. initialisation:
  40.     LEA VARS(PC),A6
  41.     bsr    a5_init
  42.     bsr    init_mac
  43.     dc.w    initresources
  44.     dc.w    teinit
  45.     move.b    #0,open_lib_dirty(a6)
  46.     bsr        putup_menu
  47.     bsr        main_loop
  48.     rts
  49.  
  50.  
  51. ************************************************************************************    
  52. *just ignore this!  This has to do with getting events!
  53.  
  54. MAIN_LOOP:
  55.     BSR    EVENTS         * MAIN LOOP STARTS HERE
  56.     BEQ.S    MAIN_LOOP
  57.     rts
  58.  
  59.  
  60. ************************************************************************************
  61. *Reg_Type_1 routine is called when Reg Type 1 is selected from the "File" menu.
  62. *This is a simple routine that compares the serial number entered to a set serial
  63. *number.  This number is 1685025387 or 646f726b in hex or "dork" in ASCII.
  64. *The registration name field is completely ignored!
  65.  
  66. Reg_Type_1:
  67.  
  68.     BSR    put_dialog                    *puts up dialog
  69.     bsr    get_dialog_action            *gets dialog items and stores contents in memory
  70.     bsr close_di                    *closes dialog
  71.     lea        reg_num_text(a6),a0        *load memory with reg number string into a0
  72.  
  73.     move.w    #$1,-(a7)                *the only parameter needed
  74.     dc.w    stringtonum                *converts number entered as reg number to hex
  75.     cmp.l    #$646f726b,d0            *does reg number entered equal to serial number?
  76.     beq        Right_number_alert        *yes
  77.     bra        Wrong_number_alert        *no
  78.     rts
  79.     
  80.     
  81. ************************************************************************************    
  82. *Reg_Type_2 routine is called when "Reg Type 2" is selected from the "File" menu.
  83. *This one adds up the ASCII values of the letters in the reg name.
  84. *Then negates the hex number and multiplies it by the ASCII value of the last 
  85. *letter in the reg name.
  86. *Then it converts the reg number entered to it's hex equivilent, then compares it to 
  87. *the real value.
  88. *If it's equal it branches to subroutine "reg_2_b" where it puts zero into d7.
  89. *It then jumps back to the main routine and tests the byte in d7.  
  90. *It jumps into another subroutine.  If d7 was not zero it branches to the "wrong reg 
  91. *numb" dialog and if it wasn't it branches to the "good reg number" dialog.
  92.  
  93. Reg_Type_2:
  94.     BSR    put_dialog                    *get dialog shi
  95.     bsr    get_dialog_action
  96.     bsr close_di
  97.     
  98.     lea        reg_name_text(a6),a0    *move pascal format of reg name into a0
  99.     move.b    (a0)+,d0                *number of letters into d0
  100.     clr.l    d1
  101.     clr.l    d2                        *where the added up ASCII values will be
  102.     bsr        reg_2                    *ascii values added up
  103.     neg.l    d2                        *negate value
  104.     mulu.w    d1,d2                    *multiply it by the ascii value of the last letter
  105.     bsr        reg_2_a
  106.     tst.b    d7                        *tests control byte (d7) to see if it's zero
  107.     bsr        reg_2_c
  108.     rts
  109.     
  110. *reg_2, adds up the ascii values of the letters in the reg name
  111. reg_2:                
  112.     move.b    (a0)+,d1
  113.     add.w    d1,d2
  114.     subi.b    #1,d0
  115.     tst.b    d0
  116.     bne        reg_2
  117.     rts    
  118.  
  119. *reg_2_a, compares entered reg number to a valid one
  120. reg_2_a:    
  121.     lea        reg_num_text(a6),a0    *load pascal format of reg number into a0
  122.     move.w    #$1,-(a7)            *the only parameter needed
  123.     dc.w    stringtonum            *converts number entered as reg number to hex
  124.     cmp.l    d0,d2                *compares the two numbers
  125.     beq        reg_2_b                *branches if equal
  126.     move.b    #1,d7    
  127.     rts
  128.     
  129. reg_2_b:
  130.     move.b    #0,d7                *sets controllbyte (d7) to 0
  131.     rts
  132.  
  133. *reg_2_c, branches depending on the value in d7
  134. reg_2_c:
  135.     bne        Wrong_number_alert            *if d7 was not zero it branches to wront # dialog
  136.     bra        Right_number_alert            *if d7 was zero it branches to right # dialog
  137.     rts    
  138.     
  139.  
  140. ************************************************************************************        
  141. *Reg_Type_3 routine is called when Reg Type 3 is selected from the File menu.
  142. *This one is bit more difficult!  I sugest you follow through the code and see what
  143. *happens or you read the CrackIt Manual where this routine is described a bit more.
  144.  
  145. Reg_Type_3:
  146.     bsr        Open_prefs                    *open the prefs file or create one if it don't
  147.                                         *exits
  148.     move.l    d0,a0                        *move handle to contents of pref file to a0
  149.     move.l    (a0),a0                        *move contets to a0
  150.     clr.l    d1
  151.     add.b    (a0)+,d1                    *adds up the first two bytes of the pref file
  152.     add.b    (a0)+,d1                    * to see if they equal two or not
  153.     cmpi.b    #2,d1
  154.     beq        check_validity                *do the first two bites in the pref file add up
  155.                                         *to two? if yes branch of to extra security check.
  156.     bsr        register_3a                    *pref file contains no valid info
  157.     rts
  158.     
  159. ***************************************************************************************
  160. *an extra check if first two bites in pref file = 2.  it does an extra check of the 
  161. *stored reg name and number and if it matches only then does the "you cracked it" 
  162. *dialog appear!
  163.  
  164. check_validity:
  165.     move.l    (a0)+,d0                *reg num in d0, and a0 has reg number
  166.     move.l    d0,d7                    *get ready for check
  167.     clr.l    d0
  168.     clr.l    d1
  169.     clr.l    d2
  170.     clr.l    d4
  171.     move.b    (a0)+,d0
  172.     bsr        reg_2                    *adds up ascii values of reg name in d2
  173.     move.l    file_contents(a6),a0    *move reg name into a0 again
  174.     add.b    #6,a0                    *regname is stored at offset 6 in pref file
  175.     move.b    (a0)+,d0                *how many letters in reg name into d0
  176.     move.l    d2,d3                    *result of reg_2 into d3
  177.     bsr        multiply                *multiplies letters with value in d2, returns
  178.                                     *result in d2
  179.     cmp.l    d7,d4                    *does the stored reg number valid to stored reg name?
  180.     bne        crack_alert                *no
  181.     bsr        You_cracked_it            *yep!  This diaolg is what yer looking for!
  182.     rts
  183.  
  184. ************************************************************************************
  185. *If the first two bytes in the pref file don't add up to be two then you'll be brought
  186. *here.  reg_3a, does all the calculations and double checking of the values entered
  187. *into the registration box.
  188.  
  189. register_3a:
  190.     bsr        Not_reg_yet                *lets you know that you've not carcked it yet
  191.     
  192.     BSR        put_dialog                *puts up dialogs and retreves info
  193.     bsr        get_dialog_action
  194.     bsr     close_di
  195.         
  196.     lea        reg_name_text(a6),a1    *let's see that reg name
  197.     cmpi.b    #10,(a1)
  198.     bgt         Wrong_number_alert        *can't have more than 10 letters in reg name!
  199.     
  200.     lea        reg_num_text(a6),a0        *loads reg number                                                                
  201.                                     *lets convert reg number to it's hex equilivient
  202.     move.w    #$1,-(a7)                *the only parameter needed
  203.     dc.w    stringtonum                *converts number entered as reg number to hex
  204.     move.l    a0,a1                    *moves entered reg number to a1
  205.     lea        reg_name_text(a6),a0    *moves entered reg name to a0
  206.                         
  207.     bsr        do_check                *does the algorythm
  208.     
  209.     bsr        compare_numbers            *compares reg number to valid one, sets flag in d0
  210.     tst.b    d0      
  211.     beq        Wrong_number_alert        *you entered wrong numer
  212.     bsr        second_check            *ain't I a bitch?  This is just to check whether
  213.                                     *someone is tampering with the program or not
  214.     
  215.     clr.l    d0
  216.     lea        pirate_flag1(a6),a2        *if any of the pirate flags do not contain one
  217.     move.b    (a2),d0                    *then someone's been trying to crack this program
  218.     lea        pirate_flag2(a6),a2
  219.     add.b    (a2),d0
  220.     
  221.     cmp.b    #2,d0                    *has someone tried to crack this?
  222.     
  223.     bne        crack_alert_prep        *d0≠2 therfore, a cracker's been at it!
  224.                 
  225.     bsr        save_data                *everything is all right so lets save the valid data
  226.     bsr        Right_number_alert        *display propper dialog
  227.     rts
  228.     
  229. ***********************************************************************************
  230. *saves the correct information to disk
  231.  
  232. save_data:
  233.     move.l    file_contents(a6),a0        *save pirate flags
  234.     lea        pirate_flag1(a6),a2
  235.     move.b    (a2),(a0)+
  236.     lea        pirate_flag2(a6),a2
  237.     move.b    (a2),(a0)+                    
  238.     move.l    d7,(a0)+                    *save hex value of reg number
  239.                                         
  240.     lea        reg_name_text(a6),a1        *setup for write_name_prep
  241.     clr.l    d1
  242.     move.b    (a1),d1
  243.     bsr        write_name_prep                *save reg name in ascii in pref file
  244.     
  245.     move.b    (a1),(a0)                    *done
  246.                                         
  247.     bsr        write_name                    *lets save the shit to disk
  248.     rts
  249.  
  250. ***********************************************************************************
  251. *I'm a bitch so I decided to have a second check for that reg number.  This should
  252. *make things a bit harder for the cracker.
  253.  
  254. second_check:
  255.     lea        pirate_flag1(a6),a2
  256.     cmpi.b    #1,(a2)                    *has there been some cracking here before?
  257.     bne        crack_alert_prep        *yes. writes reg name used to pref file
  258.                                     
  259.     lea        reg_num_text(a6),a0        *lets check that reg number again!
  260.     move.w    #$1,-(a7)                *the only parameter needed
  261.     dc.w    stringtonum                *converts number entered as reg number to hex
  262.     move.l    a0,a1                    *moves reg number to a1
  263.     lea        reg_name_text(a6),a0    *moves reg name to a0
  264.     bsr        do_check                *does comparison
  265.                                 
  266.     cmp.l    d4,d7                    *now let's see if that number's valid!
  267.     bne        crack_alert_prep        *There's a cracker at work!
  268.             
  269.     lea        pirate_flag2(a6),a2        *it's valid so let's set the second flag
  270.     move.b    #1,(a2)
  271.     rts
  272.  
  273. ***********************************************************************************
  274. *as a precaution I use this routine to write the reg name to the pref file.  And
  275. *next time you'll try to use this reg name, it'll automatically tell you that 
  276. *yer trying to crack this program!
  277. *Or so it would if I wasn't a lazy sod!  But I am so I didn't fully develop this 
  278. *protection yet.  But it still writes your reg name to disk... 
  279.  
  280. crack_alert_prep:
  281.     lea        reg_name_text(a6),a1    *get that reg name
  282.     clr.l    d1
  283.     clr.l    d2
  284.     move.b    (a1),d1
  285.     move.l    d0,d3
  286.     move.l    file_contents(a6),a0    *pointer to contents of file
  287.     add.w    #17,a0                    *pirate reg names will be stored from byte 17
  288.                             
  289.     bsr        pirate_name_check        *finds place in pref file to write to
  290.     
  291.     sub.b    #1,a0                    *to clear things up
  292.     
  293.     bsr        write_name_prep            *copies reg name to pref file
  294.     move.b    (a1),(a0)                *moves number of letters in reg nameinto pref file
  295.     
  296.     bsr        write_name                *write info to disk
  297.     
  298.     bsr        crack_alert                *show propper allert!
  299.     rts
  300.  
  301. ***********************************************************************************
  302. *finds free location in pref file to write pirate reg name to
  303.  
  304. pirate_name_check:
  305.     clr.l    d0
  306.     move.b    (a0)+,d0
  307.     cmpi.b    #0,d0
  308.     bne        pirate_name_check
  309.     rts
  310.  
  311. ***********************************************************************************
  312. *copies reg name to pref file (doesn't copy number of letters
  313. *needs number of letters used in reg name in d1 
  314. *needs source in a1, and destination in a0
  315. *(This is one way of copying a Pascal string from one place in the memory to another)
  316.  
  317. write_name_prep:
  318.     move.b    (a1,d1),d2
  319.     move.b    d2,(a0,d1)
  320.     subi.b    #1,d1
  321.     tst.b    d1
  322.     bne        write_name_prep
  323.     rts
  324.  
  325. ***********************************************************************************    
  326. *writes info to disk
  327.  
  328. write_name:
  329.     nop                                *??? something to do with too many debugs?
  330.     movem.l    a0-a7/d0-d7,-(sp)
  331.     lea        Pref_file(pc),a2        *ctype name on stack
  332.     move.l    a2,-(sp)                
  333.     
  334.     move.w    volref(a6),d5            *volref of pref folder on stack
  335.     move.w    d5,-(sp)
  336.     move.l    file_contents(a6),a0
  337.     movea.l    a0,-(sp)                *pointer to free memory
  338.     move.l    #200,-(sp)                *size of free memory
  339.     bsr        fhl_write_close1            *write and close file
  340.     move.l    (sp)+,d0                *get error
  341.     tst.l    d0
  342.     bmi        Error_alert
  343.     movem.l    (sp)+,a0-a7/d0-d7
  344.     rts
  345.  
  346. ***********************************************************************************
  347. *do check does the algorythm used to derive the valid reg number from the reg name.
  348. *First it adds up the ascii values in the reg name (in subroutine reg_2).
  349. *then it multiplys each ascii value by the sum of the previous additions and adds these
  350. *together (in routine "multiply")
  351. *needs reg name as pascal in a0
  352. *needs reg number as pascall ascii in a1
  353. *needs reg number as hex in d0
  354.  
  355. do_check:
  356.     move.l    d0,d7                    *seting up data registers
  357.     clr.l    d0
  358.     clr.l    d1
  359.     clr.l    d2
  360.     clr.l    d4
  361.     
  362.     move.b    (a0)+,d0                *puts number of letters in reg name into d0
  363.     bsr        reg_2                    *adds up ascii values of reg name in d2
  364.     lea        reg_name_text(a6),a0    *move reg name into a0 again
  365.     move.b    (a0)+,d0                *puts the number of letters in reg name into d0
  366.     move.l    d2,d3
  367.     bsr        multiply                *multiplies letters with value in d2, returns                                *result in d2
  368.     rts
  369.  
  370. ***********************************************************************************
  371. *compares entered reg number to a valid reg number
  372. *if not correct it puts up dialog, if correct it puts 1 into d0 and 1 into pirate_flag1
  373.  
  374. compare_numbers:                
  375.     cmp.l    d4,d7                    *d4 has the valid number and d7 the hex version 
  376.                                     *of the entered one
  377.     bne        Wrong_number_alert        *doesn't equal
  378.     
  379.     lea        pirate_flag1(a6),a2        *two values match so the correct measures are taken
  380.     move.b    #1,(a2)                    *puts number one into variable pirate_flag1
  381.     move.l    #1,d0
  382.     rts
  383.  
  384. ***********************************************************************************
  385. *This multiplies the ascii values of the letters in the reg name by their sum and
  386. *adds them up
  387.  
  388. multiply:
  389.     move.b    (a0)+,d1
  390.     mulu.l    d1,d2
  391.     add.w    d2,d4
  392.     move.l    d3,d2
  393.     subi.b    #1,d0
  394.     tst.b    d0
  395.     bne        multiply
  396.     rts
  397.  
  398. ***********************************************************************************
  399. *This is a routine for the OS to open the prefs file.  First it attempts to open the
  400. *pref file called "Crack" located in the system folder.  If it doesn't exist it 
  401. *creates one 200 bytes long.
  402.  
  403. Open_prefs:
  404.     movem.l    a0-a7,-(sp)                *stores adress registers    
  405.     
  406.     bsr        ffindprefs                *Finds preferenc folder on startup drive
  407.                                     *returns long Dir ID on stack
  408.     bsr        Dir_to_volref            *changes Dir ID into volref word.  
  409.                                     *returns word on stack.
  410.     move.w    (sp)+,d0
  411.     move.w    d0,volref(a6)            *store volref for folder
  412.     
  413.                                     *lets open the prefs file
  414.     lea        Pref_file(pc),a0        *put ctype name onto stack
  415.     move.l    a0,-(sp)
  416.     move.w    d0,-(sp)                *move.w    volref onto stack
  417.  
  418.     bsr        fhl_read_close            *read and close file
  419.     move.l    (sp)+,d0                *returns hande to file or error on stack
  420.     tst.l    d0                        *is it an error    (does file not exist yet?)
  421.     bpl        reg_3_open_file            *if d0 is positive the file exists 
  422.     
  423.                                     *prefs file does not exist yet so lets make a new 
  424.                                     *one 200 bytes long:
  425.     move.l    #200,d0                
  426.     dc.w    newpointerclear            *finds an empty space in memory, d0 long
  427.                                     *retunrs value in d0
  428.     move.l    a0,d0                    *check for error
  429.     tst.l    d0
  430.     bmi        Error_alert                *Error occured while freeing up memory!
  431.         
  432.     move.l    a0,save_mem(a6)            *Store pointer to free space
  433.     
  434.     move.l    #200,save_mem_counter(a6)    *store number of bytes to be saved
  435.     
  436.                                     *parameters for creating a file:
  437.     pea        Pref_file(pc)            *ctype name on stack                
  438.     move.w    volref(a6),-(sp)
  439.     move.l    save_mem(a6),a1            *setup pointer to data
  440.     move.l    a1,-(sp)
  441.     
  442.     move.l    save_mem_counter(a6),d1    *number of bytes in data to be saved (200)
  443.     move.l    d1,-(sp)
  444.     
  445.     bsr     fhl_write_close1        *let the OS write it and close it
  446.     
  447.     move.l    (sp)+,d0                *check for errors
  448.     tst.l    d0
  449.     bmi        Error_alert                *there was an error
  450.         
  451.     movem.l    (sp)+,a0-a7                *restores previous address register settings
  452.     
  453.     bra        Open_prefs                *now lets open this pref file!
  454.     rts
  455.  
  456. ************************************************************************************    
  457. *If pref file exists, it is opened.  And the handle to its data is saved to a vaiable
  458. *here, and then returns to subroutine Reg_type_3
  459.  
  460. reg_3_open_file:
  461.     move.l    d0,a0
  462.     move.l    (a0),file_contents(a6)    *store pointer to contents of pref file
  463.     movem.l    (sp)+,a0-a7
  464.     rts
  465.     
  466. ************************************************************************************    
  467. *put up the register dialogbox
  468.  
  469. put_dialog: 
  470.     clr.l    -(sp)
  471.     move.w    #128,-(sp)
  472.     clr.l    -(sp)
  473.     move.l    #-1,-(sp)
  474.     dc.w    getnewdialog
  475.  
  476.     movea.l    (a7)+,a0
  477.     move.l    a0,dialog_handle(a6)
  478.     move.l    a0,-(sp)
  479.     dc.w    setport
  480.     rts
  481.  
  482. ************************************************************************************    
  483. *handling the dialog/waiting for buttons
  484.  
  485. get_dialog_action:
  486.     clr.l    -(sp)
  487.     lea        myitem(a6),a0
  488.     move.l    a0,-(sp)
  489.     dc.w    modaldialog
  490.     move.w    myitem(a6),d0
  491.     cmpi.w    #1,d0                *its the register button
  492.     beq     getting_strings
  493.  
  494.     cmpi.w    #2,d0                *its the cancel button
  495.     
  496.     beq        close_di_quit        *closes di then quits
  497.     bra        get_dialog_action
  498.     rts
  499.     
  500. ************************************************************************************    
  501. *getting string from dialog
  502.  
  503. getting_strings: 
  504.                                         *gets the info in the reg name field
  505.     move.l    dialog_handle(a6),-(a7)        *handle of dialog
  506.     move.w    #3,-(a7)                    *resource number of reg name box
  507.     pea        itype(a6)                    *what type the item is (button/text/etc)
  508.     pea        reg_name_hand(a6)            *where text needs to go
  509.     pea        rect1(a6)                    *dimensions of rectangle (2 longs)
  510.     dc.w    getdialogitem      
  511.  
  512.     move.l    reg_name_hand(a6),-(sp)         *handle to text
  513.     pea        reg_name_text(a6)               *passes pascal string here
  514.     dc.w    getitext
  515.     
  516.                                         *gets info from the reg number field
  517.     move.l    dialog_handle(a6),-(a7)        *handle of dialog
  518.     move.w    #6,-(a7)                    *resource number of reg number box
  519.     pea        itype(a6)                    *what type the item is (button/text/etc)
  520.     pea        reg_num_hand(a6)            *where text needs to go
  521.     pea        rect2(a6)                    *dimensions of rectangle (2 longs)
  522.     dc.w    getdialogitem      
  523.  
  524.     move.l    reg_num_hand(a6),-(sp)        *handle to text
  525.     pea        reg_num_text(a6)            *passes pascal string here
  526.     dc.w    getitext
  527.     rts
  528.     
  529. ************************************************************************************    
  530. *close dialog
  531.  
  532. close_di:
  533.     move.l    dialog_handle(a6),a0
  534.     move.l    a0,-(sp)
  535.     dc.w    disposdialog
  536.     rts
  537.     
  538. ************************************************************************************
  539. *needed if user put up dialog accidentaly (meaning, clicked on the cancel button)    
  540.     
  541. close_di_quit:
  542.     move.l    dialog_handle(a6),a0
  543.     move.l    a0,-(sp)
  544.     dc.w    disposdialog
  545.     bsr        main_loop
  546.     rts            
  547.  
  548. ************************************************************************************
  549. *Alert dialog box used when the wrong reg number is entered
  550.  
  551. Wrong_number_alert:        CLR.W    -(SP)
  552.     MOVE.W    #113,-(SP)    RES ID OF ALERT
  553.     CLR.L    -(SP)
  554.     DC.W    ALERT    DO ALERT
  555.     MOVE.W    (SP)+,D0    GET RESULT
  556.     bra        QUIT_OK *
  557.     RTS
  558.     
  559. ************************************************************************************
  560. *Alert dialog box used when the correct reg number is entered
  561.  
  562. Right_number_alert:    CLR.W    -(SP)
  563.     MOVE.W    #116,-(SP)    RES ID OF ALERT
  564.     CLR.L    -(SP)
  565.     DC.W    ALERT    DO ALERT
  566.     MOVE.W    (SP)+,D0    GET RESULT
  567.     bra        QUIT_OK *
  568.     RTS
  569.  
  570. ************************************************************************************
  571. *Alert dialog box used when reg type 3 is not registered yet
  572.  
  573. Not_reg_yet:    CLR.W    -(SP)
  574.     MOVE.W    #114,-(SP)    RES ID OF ALERT
  575.     CLR.L    -(SP)
  576.     DC.W    ALERT    DO ALERT
  577.     MOVE.W    (SP)+,D0    GET RESULT
  578.     RTS
  579.     
  580. ************************************************************************************
  581. *Alert dialog box used in reg type 3 when you cracked it
  582.  
  583. You_cracked_it:    CLR.W    -(SP)
  584.     MOVE.W    #115,-(SP)    RES ID OF ALERT
  585.     CLR.L    -(SP)
  586.     DC.W    ALERT    DO ALERT
  587.     MOVE.W    (SP)+,D0    GET RESULT
  588.     bra        QUIT_OK *
  589.     RTS
  590.  
  591. ************************************************************************************
  592. *Alert dialog box used when an error occured inside the open_prefs routine
  593.  
  594. Error_alert:    CLR.W    -(SP)
  595.     MOVE.W    #129,-(SP)    RES ID OF ALERT
  596.     CLR.L    -(SP)
  597.     DC.W    ALERT    DO ALERT
  598.     MOVE.W    (SP)+,D0    GET RESULT
  599.     movem.l    (sp)+,a0-a7
  600.     bra        main_loop
  601.     RTS
  602.     
  603. ************************************************************************************
  604. *Alert dialog box used if someone's trying to crack program!
  605.  
  606. crack_alert:    
  607.     CLR.W    -(SP)
  608.     MOVE.W    #130,-(SP)    RES ID OF ALERT
  609.     CLR.L    -(SP)
  610.     DC.W    ALERT    DO ALERT
  611.     MOVE.W    (SP)+,D0    GET RESULT
  612.     bra        QUIT_OK
  613.     
  614.     RTS
  615.     
  616.     
  617. ************************************************************************************
  618. *Variables
  619. *NOTE!  These not all of these variables are used.  Some remain from previous
  620. *applications!  I just couldn't be bothered to figure out which ones were needed
  621. *and wich ones were not!
  622.  
  623. Pref_file:        dc.b    "Crack",0
  624.     EVEN
  625.  
  626.  
  627. **GLOBALS
  628.  
  629. SEVENTREC:    DS.B     16    *SCREEN EVENT RECORD
  630. 1VIEWRECT:    DS.B    8    *VIEW RECTANGLE
  631. 1BOUNDRECT:    DS.B    8
  632. PBLOCK:    DS.B    100    *PARAM BLOCK FOR I/O
  633. 1FILENAME:    DS.B    64    *FILENAME AS C STRING
  634. 1PFILENAME:    DS.B    64    *FILENAME AS PASCAL STRING
  635. 1TITLE:    DS.B    100    *WINDOW TITLE STRING
  636. PTITLE:    DS.B    100    *CONVERTED TO PASCAL
  637. 1QDGLOB:    DS.B    206    *QUICKDRAW ARRAY
  638. changable_str2:    ds.b    100
  639. wrecord:        ds.b    4    *window record
  640.  
  641. ****OFFSETS FROM A6
  642.  
  643. SCRATCH_1:    EQU    0    *.L SCRATCH VARIABLES
  644. SCRATCH_2:    EQU    4
  645. WINDPTR:    EQU     8    *.L WINDOW HANDLE
  646. TEHND:    EQU     12    *.L TEXT EDITOR HANDLE
  647. SCROLLHND:    EQU     16    *.L SCROLL BAR HANDLE
  648. VOLPTR:    EQU    20    *.W FILE POINTER
  649. NUMBLINES:    EQU    22    *.W NUMBER OF LINES IN TE
  650. LINE_POS:    EQU    26    *.L CURRENT LINE POSITION
  651. APPLEMENU:    EQU    30    *.L HANDLE OF APPLE MENU
  652. FILEMENU:    EQU    34    *.L
  653. EDITMENU:    EQU    38    *.L
  654. CURTOP:    EQU    42    *.L TOP OF WINDOW
  655. DIRTY:    EQU    46    *.W FILE DIRTY WORD
  656. LONG_VAR:    EQU    48    *.L GENERAL SCRATCH VARIABLE
  657. MAX_F_SIZE:    EQU    52    *.L TEMPORY STOARAGE
  658. dialog_handle:    equ 56
  659. myitem:            equ    60
  660. reg_name_hand:    equ 64
  661. itype:            equ    68
  662. rect1:            equ 70
  663. reg_name_text:    equ 78
  664. wptr:        equ 98
  665. volref:            equ 100
  666. pbhandle:        equ 102
  667. save_mem_counter:    equ 106
  668. save_mem:            equ 110
  669. open_lib_dirty:        equ    114
  670. lib_ptr:            equ 116
  671. numb_of_letters:    equ    120
  672. numb_of_lib_letters:    equ    124
  673. reg_num_hand:    equ    128
  674. rect2:            equ    132
  675. reg_num_text:    equ 140
  676. file_contents:    equ    160
  677. pirate_flag1:    equ    164
  678. pirate_flag2:    equ    166
  679.  
  680. ******************************************************
  681.  
  682. VARS:    DS.b    168    *A6 VARIABLES
  683. align
  684. INCLUDE        IO_LIB.S
  685. include        regevents.s
  686. include        regmenu.s
  687.  
  688.  
  689. *************
  690.     global    initialisation
  691.     extern    a5_init,ffindprefs,strcmp,fopen,fhl_write_close1,fhl_read_close,Dir_to_volref
  692.